<?php 
require_once('./loadtable.php');
echo '<link href="./styledataconllection.css" rel="stylesheet" type="text/css">';
?>
					<script>
					  $(function() {
						var tabs = $( "#tabforms" ).tabs();
						tabs.find( ".ui-tabs-nav" ).sortable({
						  axis: "x",
						  stop: function() {
							tabs.tabs( "refresh" );
						  }
						});
					  });
					  $(function() {
						var tabs = $( "#tabconllections" ).tabs();
						tabs.find( ".ui-tabs-nav" ).sortable({
						  axis: "x",
						  stop: function() {
							tabs.tabs( "refresh" );
						  }
						});
					  });
					  </script>
<script type='text/javascript' src='./jquery/picnet.table.filter.min.js'></script>    
    <script type='text/javascript'>
        $(document).ready(function() {
          // Initialise Plugin
            var options1 = {
                additionalFilterTriggers: [$('#onlyyes'), $('#onlyno'), $('#quickfind')],
                clearFiltersControls: [$('#cleanfilters')],
                matchingRow: function(state, tr, textTokens) {
                  if (!state || !state.id) {
                    return true;
                }
                  var child = tr.children('td:eq(2)');
                  if (!child) return true;
                  var val = child.text();
                  switch (state.id) {
                  case 'onlyyes':
                    return state.value !== true || val === 'yes';
                  case 'onlyno':
                    return state.value !== true || val === 'no';
                  default:
                    return true;
                }
              }
          };
            $('#filtertable').tableFilter(options1);
      
      });
    </script>
	<script type='text/javascript'>
	$(document).ready(function() {
		$("#deletedata").click(function(event){
			$('#contents').load('./loadtable.php');
		});
	});
	</script>

<div id="wrapper">
    <div class="content">
        <div id="tabs">
            <ul>
                <li><a href="#tabs-1">Data Collection</a></li>
			</ul>
			
            <div id="tabs-1">
			<!--<div class="date">
                        <input type="hidden" id="begin" name="begin" value="03-03-2014">
                        <input type="hidden" id="end" name="end" value="09-03-2014">

                        <input type="text" id="duration" name="duration" size="25" autocomplete="off">
                    </div>-->
                <form id="report" method="post" action="action.php">
                    <div id="loading_tree"><p id="saved"></p></div>
                    <div class="query-tree" style="display:none">
                        <!--query tree-->
						<div id="tree" class="tree jstree jstree-0 jstree-focused jstree-default" style="height: 90%;"><ul><li id="node_2" rel="drive" class="jstree-last jstree-open"><ins class="jstree-icon">&nbsp;</ins><a href="http://insight.webm.vn/report#" class=""><ins class="jstree-icon">&nbsp;</ins>Root</a><ul><li id="node_243" rel="folder" class="jstree-closed"><ins class="jstree-icon">&nbsp;</ins><a href="http://insight.webm.vn/report#"><ins class="jstree-icon">&nbsp;</ins>Samsung</a></li><li id="node_272" rel="folder" class="jstree-closed"><ins class="jstree-icon">&nbsp;</ins><a href="http://insight.webm.vn/report#"><ins class="jstree-icon">&nbsp;</ins>Trend Study</a></li><li id="node_315" rel="folder" class="jstree-closed"><ins class="jstree-icon">&nbsp;</ins><a href="http://insight.webm.vn/report#"><ins class="jstree-icon">&nbsp;</ins>Coca-Cola</a></li><li id="node_372" rel="folder" class="jstree-closed"><ins class="jstree-icon">&nbsp;</ins><a href="http://insight.webm.vn/report#"><ins class="jstree-icon">&nbsp;</ins>Unilever</a></li><li id="node_494" rel="folder" class="jstree-open"><ins class="jstree-icon">&nbsp;</ins><a href="http://insight.webm.vn/report#" class=""><ins class="jstree-icon">&nbsp;</ins>THP</a><ul><li id="node_495" rel="folder" class="jstree-last jstree-open"><ins class="jstree-icon">&nbsp;</ins><a href="http://insight.webm.vn/report#" class=""><ins class="jstree-icon">&nbsp;</ins>Dr Thanh</a><ul><li id="node_504" rel="default" class="jstree-leaf"><ins class="jstree-icon">&nbsp;</ins><a href="http://insight.webm.vn/report#" class="jstree-clicked"><ins class="jstree-icon">&nbsp;</ins>Dr Thanh</a></li><li id="node_505" rel="default" class="jstree-leaf"><ins class="jstree-icon">&nbsp;</ins><a href="http://insight.webm.vn/report#"><ins class="jstree-icon">&nbsp;</ins>Dr Thanh Lunar New Year campaign</a></li><li id="node_763" rel="default" class="jstree-leaf"><ins class="jstree-icon">&nbsp;</ins><a href="http://insight.webm.vn/report#"><ins class="jstree-icon">&nbsp;</ins>Dr Thanh fanpage</a></li><li id="node_764" rel="default" class="jstree-leaf"><ins class="jstree-icon">&nbsp;</ins><a href="http://insight.webm.vn/report#"><ins class="jstree-icon">&nbsp;</ins>Dr Thanh other Facebook pages</a></li><li id="node_722" rel="default" class="jstree-leaf"><ins class="jstree-icon">&nbsp;</ins><a href="http://insight.webm.vn/report#"><ins class="jstree-icon">&nbsp;</ins>Dr Thanh crisis</a></li><li id="node_506" rel="default" class="jstree-leaf"><ins class="jstree-icon">&nbsp;</ins><a href="http://insight.webm.vn/report#"><ins class="jstree-icon">&nbsp;</ins>C2</a></li><li id="node_507" rel="default" class="jstree-leaf"><ins class="jstree-icon">&nbsp;</ins><a href="http://insight.webm.vn/report#"><ins class="jstree-icon">&nbsp;</ins>C2 campaigns</a></li><li id="node_723" rel="default" class="jstree-leaf"><ins class="jstree-icon">&nbsp;</ins><a href="http://insight.webm.vn/report#"><ins class="jstree-icon">&nbsp;</ins>C2 crisis</a></li><li id="node_794" rel="default" class="jstree-leaf"><ins class="jstree-icon">&nbsp;</ins><a href="http://insight.webm.vn/report#"><ins class="jstree-icon">&nbsp;</ins>C2 fanpage</a></li><li id="node_508" rel="default" class="jstree-leaf"><ins class="jstree-icon">&nbsp;</ins><a href="http://insight.webm.vn/report#"><ins class="jstree-icon">&nbsp;</ins>Tra Olong Tea Plus</a></li><li id="node_509" rel="default" class="jstree-leaf"><ins class="jstree-icon">&nbsp;</ins><a href="http://insight.webm.vn/report#"><ins class="jstree-icon">&nbsp;</ins>Tra Olong Tea Plus Lunar New Year campaign</a></li><li id="node_724" rel="default" class="jstree-leaf"><ins class="jstree-icon">&nbsp;</ins><a href="http://insight.webm.vn/report#"><ins class="jstree-icon">&nbsp;</ins>Tea Plus crisis</a></li><li id="node_793" rel="default" class="jstree-leaf"><ins class="jstree-icon">&nbsp;</ins><a href="http://insight.webm.vn/report#"><ins class="jstree-icon">&nbsp;</ins>Tea Plus fanpage</a></li><li id="node_510" rel="default" class="jstree-leaf"><ins class="jstree-icon">&nbsp;</ins><a href="http://insight.webm.vn/report#"><ins class="jstree-icon">&nbsp;</ins>Tra bi dao Wonderfarm</a></li><li id="node_511" rel="default" class="jstree-leaf"><ins class="jstree-icon">&nbsp;</ins><a href="http://insight.webm.vn/report#"><ins class="jstree-icon">&nbsp;</ins>Tra bi dao Wonderfarm campaigns</a></li><li id="node_512" rel="default" class="jstree-last jstree-leaf"><ins class="jstree-icon">&nbsp;</ins><a href="http://insight.webm.vn/report#"><ins class="jstree-icon">&nbsp;</ins>Crisis Monitoring</a></li></ul></li></ul></li><li id="node_585" rel="folder" class="jstree-closed"><ins class="jstree-icon">&nbsp;</ins><a href="http://insight.webm.vn/report#"><ins class="jstree-icon">&nbsp;</ins>Masan</a></li><li id="node_595" rel="folder" class="jstree-closed"><ins class="jstree-icon">&nbsp;</ins><a href="http://insight.webm.vn/report#"><ins class="jstree-icon">&nbsp;</ins>VBL</a></li><li id="node_615" rel="folder" class="jstree-closed"><ins class="jstree-icon">&nbsp;</ins><a href="http://insight.webm.vn/report#"><ins class="jstree-icon">&nbsp;</ins>Campaign Year 2013 Review</a></li><li id="node_650" rel="folder" class="jstree-closed"><ins class="jstree-icon">&nbsp;</ins><a href="http://insight.webm.vn/report#"><ins class="jstree-icon">&nbsp;</ins>Cosmetics</a></li><li id="node_662" rel="folder" class="jstree-closed"><ins class="jstree-icon">&nbsp;</ins><a href="http://insight.webm.vn/report#"><ins class="jstree-icon">&nbsp;</ins>Pepsi</a></li><li id="node_682" rel="folder" class="jstree-closed"><ins class="jstree-icon">&nbsp;</ins><a href="http://insight.webm.vn/report#"><ins class="jstree-icon">&nbsp;</ins>Kimberly Clark</a></li><li id="node_719" rel="folder" class="jstree-closed"><ins class="jstree-icon">&nbsp;</ins><a href="http://insight.webm.vn/report#"><ins class="jstree-icon">&nbsp;</ins>Ogilvy</a></li><li id="node_751" rel="folder" class="jstree-closed"><ins class="jstree-icon">&nbsp;</ins><a href="http://insight.webm.vn/report#"><ins class="jstree-icon">&nbsp;</ins>Others</a></li><li id="node_774" rel="folder" class="jstree-closed"><ins class="jstree-icon">&nbsp;</ins><a href="http://insight.webm.vn/report#"><ins class="jstree-icon">&nbsp;</ins>Pepsi</a></li><li id="node_798" rel="folder" class="jstree-closed jstree-last"><ins class="jstree-icon">&nbsp;</ins><a href="http://insight.webm.vn/report#"><ins class="jstree-icon">&nbsp;</ins>Category Review</a></li></ul></li></ul></div>
                        <div id="save_query">
                            <label id="save_as_tab"><a title="Save As"><img src="./BuzzInsight_files/saveAs_icon.gif"></a></label>
                            <label id="save_tab"><a title="Save"><img src="./BuzzInsight_files/save_icon.gif" alt="Save"></a></label>
                        </div>
						<div id="mmenu" style="height:30px; overflow:auto;">    
							<a id="add_folder" href="http://insight.webm.vn/report#"></a>	
						</div>
                        <div id="tree_contextmenu" class="tree_contextmenu" hidden="hidden" style="display: none; top: 76px; left: 233px;">
                            <ul>
                                <li id="create_group" class="tree_contextmenu-hr">Create group</li>
                                <li id="create_query">Create query</li>
                                <li class="tree_item">Rename</li>
                                <li class="tree_contextmenu-hr tree_item">Delete</li>
                                <li class="tree_item">Edit</li>
                            </ul>
                        </div>
                        <!--end query tree-->
                    </div>
                    <div id="add_query_text" style="display: none">
                        <textarea class="add_query_text"></textarea>
                    </div>
                    <div class="query">
					<div style="display:none">
						<input type='checkbox' id='onlyyes'/>          
						<input type='checkbox' id='onlyno'/>
						<input type='submit' value='Set Quick Find filter and refresh table' onclick="$('#quickfind').val('12'); $('#demotable1').tableFilterApplyFilterValues();"/>
					   
						<input type='text' id='quickfind'/>

						<a id='cleanfilters' href='#'>Clear Filters</a>
						<div class='clear'></div>
					</div>
						<table id="filtertable" style="width: 100%;">
							<thead>
								<tr class="table_title">
									<th filter-type='ddl' style="width: 5%;">
										<select id="datatype" name="datatype" onchange="id_type(this);">
											<option value="0">Type</option>
											<option value="Link">Link</option>
											<option value="Page">Page</option>
											<option value="Keywords">Keywords</option>
										</select>
									</th>
									<th style="width: 25%;">Link</th>
									<th filter-type='ddl' style="width: 5%;">Category</th>
									<th filter-type='ddl' style="width: 10%;">Project</th>
									<th filter-type='ddl' style="width: 5%;">CGM Type</th>
									<th style="width: 10%;">Added Date</th>
									<th filter-type='ddl' style="width: 5%;">Added by</th>
									<th filter-type='ddl' style="width: 10%;">Status</th>
									<th filter-type='ddl' style="width: 5%;">Status IT</th>
									<th filter-type='ddl' style="width: 10%;">In charge</th>
									<th filter-type='ddl' style="width: 10%;">Note</th>
								</tr>
							</thead>
							<tbody id="contents">
								<?php loaddata();?>
							</tbody>
						</table>
								<!--
								<tbody id="contents">
								<tr>
									<td style="display:none"><input class="inputdata" type="text" name="typeud[]" value="type"/></td>
									<td class="overload" title="https://www.facebook.com/capdoihoanhao.vn"><div id="page-user"><input class="inputdata" type="text" name="linkud[]" value="https://www.facebook.com/capdoihoanhao.vn"/></td>
									<td class="overload" title="Life Style/beauty/Celeb"><div id="page-user"><input class="inputdata" type="text" name="categoryud[]" value="Life Style/beauty/Celeb" /></td>
									<td class="overload" title="Pepsi"><div id="page-user"><input class="inputdata" type="text" name="projectud[]" value="Pepsi" /></td>
									<td class="overload" title="Facebook pages"><div id="page-user"><input class="inputdata" type="text" name="cgmtypeud[]" value="Facebook pages" /></td>
									<td class="overload"><input class="inputdata" type="text" name="addeddateud[]" value="<?php date_default_timezone_set('Asia/Ho_Chi_Minh');echo date('Y-m-d');?>" /></td>
									<td class="overload" title="Nhung Nguyen"><input class="inputdata" type="text" name="addedbyud[]" value="Nhung Nguyen" /></td>
									<td class="overload" title="Waiting"><input class="inputdata" type="text" name="statusud[]" value="Waiting" /></td>
									<td class="overload" title="Done"><input class="inputdata" type="text" name="statusitud[]" value="Done" /></td>
									<td class="overload" title="Than Le"><input class="inputdata" type="text" name="inchargeud[]" value="Than Le" /></td>
									<td class="overload" title="Bị lỗi"><input class="inputdata" type="text" name="noteud[]" value="Bị lỗi" /></td>
								</tr>
								<tr>
									<td style="display:none"><input class="inputdata" type="text" name="typeud[]" value="type"/></td>
									<td class="overload" title="https://www.facebook.com/capdoihoanhao.vn"><div id="page-user"><input class="inputdata" type="text" name="linkud[]" value="https://www.facebook.com/capdoihoanhao.vn"/></td>
									<td class="overload" title="Life Style/beauty/Celeb"><div id="page-user"><input class="inputdata" type="text" name="categoryud[]" value="Life Style/beauty/Celeb" /></td>
									<td class="overload" title="Pepsi"><div id="page-user"><input class="inputdata" type="text" name="projectud[]" value="Pepsi" /></td>
									<td class="overload" title="Facebook pages"><div id="page-user"><input class="inputdata" type="text" name="cgmtypeud[]" value="Facebook pages" /></td>
									<td class="overload"><input class="inputdata" type="text" name="addeddateud[]" value="<?php date_default_timezone_set('Asia/Ho_Chi_Minh');echo date('Y-m-d');?>" /></td>
									<td class="overload" title="Nhung Nguyen"><input class="inputdata" type="text" name="addedbyud[]" value="Nhung Nguyen" /></td>
									<td class="overload" title="Waiting"><input class="inputdata" type="text" name="statusud[]" value="Waiting" /></td>
									<td class="overload" title="Done"><input class="inputdata" type="text" name="statusitud[]" value="Done" /></td>
									<td class="overload" title="Than Le"><input class="inputdata" type="text" name="inchargeud[]" value="Than Le" /></td>
									<td class="overload" title="Bị lỗi"><input class="inputdata" type="text" name="noteud[]" value="Bị lỗi" /></td>
								</tr>
								</tbody>-->
							
                    </div>
					<button class="button-data" type="button" id="add" style="position: absolute;  bottom: 3px;  left: 3px;">Insert</button>
					<button class="button-data" type="button" id="adds" style="position: absolute;  bottom: 3px;  left: 110px;">Inserts</button>
					<button onclick="myFunction()" class="button-data" type="button" id="deletedata" style="position: absolute;bottom: 3px;left: 217px;">Delete Data</button>
					<button class="button-data" type="submit" id="savedata" style="position: absolute;bottom: 3px;right: 3px;">Save</button>
					<button type="button" onclick="removeTrs()" class="button-data remoteall1">Delete All</button>
					</form>
					<script>
					function myFunction()
					{
					window.open("./loadtable.php");
					}
					</script>
					<script>
						var type='Link';
						function id_type(targetth){
							type = targetth.value;
						}
						function removeTrs() {
							//$(".tbody_of_items td").remove();
							$(".tbody_of_items").remove();
							$('.remoteall').addClass('remoteall1');
							$('.remoteall').removeClass('remoteall');
						}
						function removeRow(obj){
							obj = $(obj);
							obj.parent().parent().remove();
						}
						$('#add').click(function(){
							var html = '<tr class= "tbody_of_items"><td ><input class="inputdata" type="text" name="type[]" value="'+type+'"/></td><td><input class="inputdata" type="text" name="link[]" value=""/></td><td><input class="inputdata" type="text" name="category[]" value="Life Style/beauty/Celeb"/></td><td><input class="inputdata" type="text" name="project[]" value="Pepsi"/></td><td><input class="inputdata" type="text" name="cgmtype[]" value="Facebook pages"/></td><td><input class="inputdata" type="text" name="addeddate[]" value="<?php date_default_timezone_set('Asia/Ho_Chi_Minh');echo date('Y-m-d');?>"/></td><td><input class="inputdata" type="text" name="addedby[]" value="Nhung Nguyen"/></td><td><input class="inputdata" type="text" name="status[]" value="Waiting"/></td><td><input class="inputdata" type="text" name="statusit[]" value="Working"/></td><td><input class="inputdata" type="text" name="incharge[]" value=""/></td><td><input class="inputdata" type="text" name="note[]" value=""/></td><td><button type="button" onclick="removeRow(this)">x</button></td></tr>';
							//var remoteall ='<button type="button" id="rmall">x</button>';
							$('#contents').append(html);
							//$('.remoteall1').append(remoteall);
							$('.remoteall1').addClass('remoteall');
							$('.remoteall1').removeClass('remoteall1');
						});
						$('#adds').click(function(){
							var html = '<tr class= "tbody_of_items"><td ><input class="inputdata" type="text" name="type[]" value="'+type+'"/></td><td><textarea style="width: 90%;position: relative;" class="inputdata" type="text" name="link[]" value=""/></textarea></td><td><input class="inputdata" type="text" name="category[]" value="Life Style/beauty/Celeb"/></td><td><input class="inputdata" type="text" name="project[]" value="Pepsi"/></td><td><input class="inputdata" type="text" name="cgmtype[]" value="Facebook pages"/></td><td><input class="inputdata" type="text" name="addeddate[]" value="<?php date_default_timezone_set('Asia/Ho_Chi_Minh');echo date('Y-m-d');?>"/></td><td><input class="inputdata" type="text" name="addedby[]" value="Nhung Nguyen"/></td><td><input class="inputdata" type="text" name="status[]" value="Waiting"/></td><td><input class="inputdata" type="text" name="statusit[]" value="Working"/></td><td><input class="inputdata" type="text" name="incharge[]" value=""/></td><td><input class="inputdata" type="text" name="note[]" value=""/></td><td><button type="button" onclick="removeRow(this)">x</button></td></tr>';
							//var remoteall ='<button type="button" id="rmall">x</button>';
							$('#contents').append(html);
							//$('.remoteall1').append(remoteall);
							$('.remoteall1').addClass('remoteall');
							$('.remoteall1').removeClass('remoteall1');
						});
					</script>
                <div class="clear"></div>
            </div>
        </div>
		</div>
    </div>
</div>
